package com.zxjbyte.yiyi.framework.common.enums;

import lombok.Getter;

import java.util.Arrays;

/**
 * 可选扩展模块
 * @Author zhangxingjia
 * @Date 2025/3/19 18:40
 * @Version: 1.0
 */
@Getter
public enum ExtensionBundles {
    JOB(new String[]{"job"}, new String[]{"job.config.QuartzBaseConfig"}),
    INBOX(new String[]{"inbox"}),
    MONITOR(new String[]{"monitor"}),
    MESSAGING(new String[]{"socket", "sse"}, new String[]{"socket.config.WebSocketConfig"});

    private static final String BASE_PACKAGE = "com.zxjbyte.yiyi.extension";
    private final String[] basePackage;
    private String[] configClassNames;

    ExtensionBundles(String[] subPackages, String[] configClassRelativeNames) {
        this.basePackage = Arrays.stream(subPackages).map(sub -> BASE_PACKAGE + "." + sub).toArray(String[]::new);
        if (configClassRelativeNames != null && configClassRelativeNames.length > 0) {
            this.configClassNames = Arrays.stream(configClassRelativeNames).map(relativeName -> BASE_PACKAGE + "." + relativeName).toArray(String[]::new);
        }
    }

    ExtensionBundles(String[] subPackages) {
        this(subPackages, null);
    }
}
